package com.yzt.minemodule.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.user.PersonEditLayoutEntry;
import com.yzt.minemodule.R;

/**
 * author : bob
 * date   : 2022/12/8
 * desc   : 个人资料编辑的适配器
 */
public class PersonEditLayoutAdapter extends BaseQuickAdapter<PersonEditLayoutEntry, BaseViewHolder> {

    public PersonEditLayoutAdapter() {
        super(R.layout.item_person_edit_layout);
    }

    @Override
    protected void convert(BaseViewHolder holder, PersonEditLayoutEntry item) {
        holder.setText(R.id.title_label_tv, item.getTitle());
        TextView contentTv = holder.getView(R.id.content_tv);
        contentTv.setTextColor(ContextCompat.getColor(getContext(), R.color.color_6d7278));
        contentTv.setText(item.getContent());
        ImageView rightIcon = holder.getView(R.id.right_icon);
        if (item.getId() == PersonEditLayoutEntry.TYPE_GENDER) {
            rightIcon.setVisibility(View.GONE);
        } else {
            rightIcon.setVisibility(View.VISIBLE);
        }
    }
}

